#define  _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
#include<string.h>

void reverse(char* left, char* right)
{
    while (left < right)
    {
        char temp = *left;
        *left = *right;
        *right = temp;
        left++;
        right--;
    }
}
char arr[10000] = { 0 };
int main()
{
    char a[1001] = { 0 }, b[1001] = { 0 };
    scanf("%s", arr);
    int len = strlen(arr), i = 0, x = 0, j = 0, flag = 1;
    for (i = 0; i < len; i++)
    {
        if (arr[i] >= 'a' && arr[i] <= 'z')
        {
            flag = 0;
            break;
        }
    }
    if (flag == 1)
    {
        printf("NO\n");
    }
    else
    {
        for (i = 0; i < len; i++)
        {
            if (arr[i] == '&')
            {
                x = i;
                break;
            }
        }
        for (i = 0; i < x; i++)
        {
            a[i] = arr[i];
        }
        for (i = x + 1, j = 0; i < len; i++, j++)
        {
            b[j] = arr[i];
        }
        reverse(b, b + j - 1);
        if (strcmp(a, b) == 0)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}